package project

import "time"

// Pusher 用于解析 Webhook 消息 推送者的整体内容
type Pusher struct {
	Pusher struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"pusher"`

	Sender struct {
		HTMLURL string `json:"html_url"`
	} `json:"sender"`

	Commits []struct {
		Message   string    `json:"message"`
		Timestamp time.Time `json:"timestamp"`
		URL       string    `json:"url"` // 添加了提交详情链接
	} `json:"commits"`

	Compare string `json:"compare"` // 提交前后对比链接
}

// ProjectDetails 用于解析项目相关的详细信息
type ProjectDetails struct {
	Project struct {
		Name  string `json:"name"`
		Owner struct {
			Name    string `json:"name"`
			HTMLURL string `json:"html_url"`
			Email   string `json:"email"`
		} `json:"owner"`
		GitURL     string `json:"git_url"`
		GitHTTPURL string `json:"git_http_url"`
		Language   string `json:"language"`
		Path       string `json:"path"`
	} `json:"project"`

	Repository struct {
		GitHTTPURL string `json:"git_http_url"`
	} `json:"repository"`
}

// ProjectTag 记录项目的版本信息
type ProjectTag struct {
	TagVersion string `json:"ref"`
	Project    struct {
		GitHttpURL string `json:"git_http_url"`
	} `json:"project"`
}

// ProDetails 封装返回的项目信息数据
type ProDetails struct {
	ID                   uint64 `json:"id" form:"id"`
	CaptainID            uint64 `json:"captain_id" form:"captain_id"`
	ProjectID            uint64 `json:"project_id" form:"project_id"`
	ProjectName          string `json:"project_name" form:"project_name"`
	ProjectOwnerName     string `json:"project_owner_name" form:"project_owner_name"`
	ProjectOwnerHTMLURL  string `json:"project_owner_html_url" form:"project_owner_html_url"`
	ProjectOwnerEmail    string `json:"project_owner_email" form:"project_owner_email"`
	ProjectGitURL        string `json:"project_git_url" form:"project_git_url"`
	RepositoryGitHTTPURL string `json:"repository_git_http_url" form:"repository_git_http_url"`
	CommitsURL           string `json:"commits_url" form:"commits_url"`
	ProjectLanguage      string `json:"project_language" form:"project_language"`
	Path                 string `json:"path" form:"path"`
}
